<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>封装动画函数</title>
    <style>
       
    </style>
</head>

<body>
    <label>价格:2999.00</label>
    <button class="btn">打折</button>
    <script src="./animation.js"></script>
    <script>
        const label=document.querySelector('label');
        const btn=document.querySelector('.btn');
        btn.onclick=function(){
            //开始动画
            animation(1000,2999,299,(val)=>{
                label.textContent=`价格：${val.toFixed(2)}`
            })
        }
    </script>
</body>

</html>